package work.tree;

import work.TreeNode;

public class Problem101 {

    public boolean isSymmetric(TreeNode root) {
        TreeNode right = root.right;
        TreeNode left = root.left;
        return compare(right, left);
    }

    public boolean compare(TreeNode right, TreeNode left) {
        if (right == null || left == null) return right == left;
        boolean compare1 = compare(right.right, left.left);
        boolean compare2 = compare(right.left, left.right);
        return right.val == left.val && compare1 && compare2;
    }

    public static void main(String[] args) {
        TreeNode treeNode = new TreeNode();
        Integer[] num = new Integer[]{1, 2, 3, 4, 5};
        TreeNode treeNode1 = treeNode.constructTree(num);
        treeNode1.left.printTree();
        boolean b = true && false;
        boolean b1 = true || false;
        System.out.println("asd");
    }



}
